<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php echo $this->Facebook->html(); ?>
<?php
	if(isset($keyword) and ($keyword))
		{
			$keyword = $keyword;
		}
	else
		 {
			 $keyword = "";
		 }
	 
	if(isset($description) and ($description))
		{
			$description = $description;
		}
	else
		{
			 $description = "";
		}
	 
?>
<head>
<?php echo $this->Html->meta('favicon.ico','/favicon.ico',array('type' => 'icon'));?>
<?php echo $this->Html->meta('Comments','/comments/index.rss',array('type' => 'rss'));?>
<?php echo $this->Html->meta('keywords',$keyword);?>
<?php echo $this->Html->meta('description','Shopping Mall, '.$description.'');
	  echo $this->Html->meta(array('name' => 'robots', 'content' => 'noindex')); 
?> 
 <title>
	<?php  
			if(isset($title_for_layout) and ($title_for_layout))
				{
					$title_for_layout = $title_for_layout;
				}
			else
				 {
					 $title_for_layout = "WonderE";
				 }
			echo $title_for_layout;
	 ?>
</title>
   <?php //echo $scripts_for_layout; $website_url = Configure::read('Website.url'); ?>
	<?php  echo $html->css(
                            array(
                                    'style','SpryTabbedPanels','rating/jquery.rating','jquery.tabs','jquery.tabs-ie'
								 )
                            );
	 ?>
    <?php 
			echo $html->script(array(
									'jquery-1.6.4.min', 
									'custom-form-elements', 
									'SpryTabbedPanels',
									'ddaccordion',		
									'rating/jquery.MetaData',
									'rating/jquery.rating',
									'rating/jquery.rating.pack', 
									'epic-image-zoom.min',
									'jquery.tabs.pack',
									'jquery.history_remote.pack',
									'jquery.validate.min',
									'jquery.validate.creditcardtypes',
									'jquery.autocomplete',
									'ssAutoComplete',
									'main'
									
							)) ;
	?>
<!--	<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
-->    <script type="text/javascript">var switchTo5x=true;</script>
    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript">stLight.options({publisher: "2ec0fc92-9cae-4ec6-b9fc-b84d9e5dae46"}); </script>
    <script type="text/javascript">
            $(function() {
              $('#add_prod').tabs({ fxSlide: false, fxFade: false, fxSpeed: 'normal' });
            });
        </script>

    <script>
	function isValidEmailAddress(emailAddress) {
			var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
    return pattern.test(emailAddress);
}

	function validation(){
			var firstmail  = $("#author_email").val();
			var secondmail  = $("#author_confirm_email").val();
			if(firstmail.length != 0){
			if(!isValidEmailAddress(firstmail)){
			$("#error").html('please fill first mail valid');
			}
			
			}
			else
			$("#error").html('first mail is required');
			if(secondmail.length != 0){
			if(!isValidEmailAddress(secondmail)){
			$("#error").html('please fill second mail valid');
			}
			}
			else
			$("#error").html('second mail required');
			
			if(firstmail != secondmail){
			$("#error").html('mail not match');
			}
		}

	 $(document).ready(function(){
		 $("#checkout_form").validate();
		/*$("img").each(function(intIndex) {
			var width = $(this).attr("width");
			var height = $(this).attr("height");
			var src = $(this).attr("src");
			var ful_src;
			var src = $(this).attr("src");
			var width = $(this).attr("width");
			if(width && height)
			{
				ful_src = "http://marketplace.pnf-sites.info/timthumb.php?src="+src+'&w='+width+"&h="+height;
				$(this).removeAttr("width");
				$(this).removeAttr("height");

			}
			else if(width)
			{
				ful_src = "http://marketplace.pnf-sites.info/timthumb.php?src="+src+'&w='+width;
				$(this).removeAttr("width");
			}
			else if(height)
			{
				ful_src = "http://marketplace.pnf-sites.info/timthumb.php?src="+src+'&h='+height;
				$(this).removeAttr("height");
			}
			else
			{
				ful_src = src; 
			}
		$(this).attr({ 
					  src: ful_src,
					  alt: 'image',
					});
		});*/

		$('#addaddressWishList').click(function(){
			$('#wishlistaddaddress').show();
		});
		
		$('.firstcheck').click(function(){
			$('#wishlistaddaddress').hide();
			$('#wishlistaddaddress input').each(function(intIndex) {
				$(this).attr('value', '');
			});
		});
		
		
						
		$("#signupLoginForm").validate();
		$("#LoginForm").validate();
		$('.validate').validate();
		$('.update_load').click(function() {
			location.reload();
		});
		$(".price").live("keypress", function () {
		  if (isNaN($(this).val()) )
		 {
			alert("Enter numeric values");
			$(this).attr('value',"1");
		 }
		});
		
		$('.na1 li ul.subcat').hover(function(){
				var id = $(this).attr('id');
				//alert(id);
				//return false;
				$('#'+id).parent('li').toggleClass('selected');
			});
		
		/*variable image rotate*/
			var variable_image_img_src = $('.item_1_left img.variable_image').attr('src');
			$('.item_1_left img.variable_image').attr('alt', variable_image_img_src);
			
			$('.item_1_left .thumbs img').click(function(){
						var img_src = $(this).attr('src');
						var variable_attr = $('.variable_image').attr('src');
						$('.variable_image').attr('src', img_src);
						$('.eiz-magnifier div img').attr('src', img_src);
						$(this).attr('src', variable_attr);
			});
			/*$('.item_1_left .thumbs img').mouseleave(function(){
				var altvariable_image =$('.variable_image').attr('alt');
				$('.variable_image').attr('src', altvariable_image);
			});*/
		/* End variable image rotate*/
		
		 $(".price").live("keyup", function () {
			if (isNaN($(this).val())  )
			 {
				alert("Enter numeric values");
				$(this).attr('value',"1");
			 }
		});
		
		$(".price").live("click", function () {
			if (($(this).val() == "" ))
			 {
				alert("Enter numeric values");
				$(this).attr('value',"1");
			 }
			 
		});
		 $('.cartpriceupdate a').click(function(){
				var cartpriceupdateclass = $(this).attr('class');
				var final_value = $('#'+cartpriceupdateclass).attr('value');
				var final_valuehref =  $('.'+cartpriceupdateclass).attr('href');
				var new_href = final_valuehref+'^'+final_value;
				$('.'+cartpriceupdateclass).attr('href', new_href);
		 });
		 
		 $('.cat_page_left_list ul li input[type="checkbox"].specific').click(function(){
			var label_checkbox_value = $(this).attr('value');
			var session = $(this).attr('session');  
			var pathname = window.location.pathname;
			pathname = 'http://wondere.com'+pathname;
			var pathname_exp = pathname.split(':');
			var GotIt;
			var happyIGot;
			for(var i=0; i<pathname_exp.length; i++)
				{
					if(pathname_exp[i])
					{
						pathname_exp_for = pathname_exp[i].split('/');
						
						for(var i1=0; i1<pathname_exp_for.length; i1++)
							{
								if(pathname_exp_for[i1])
								{
									pathname_exp_for_in_if = pathname_exp_for[i1].split(', ');
									GotIt = true;
									for(var i11=0; i11<pathname_exp_for_in_if.length; i11++)
										{
											if(pathname_exp_for_in_if[i11])
											{
												//console.log(pathname_exp_for_in_if[i11]);
												var specification = 'specification';
												if(pathname_exp_for_in_if[i11]==specification)
												{
												  GotIt ='true';
												  happyIGot = GotIt;
												  
												}
											else
												{
													GotIt ='false';
												}

											}
										}
								}
							}
					}
				}
				
			    var dataString = 'label_checkbox_value='+label_checkbox_value;
			$.ajax
				({
					type: "POST",
					url: "<?php echo $website_url . 'categories/get_specifications';?>",
					data: dataString,
					cache: false,
					success: function(html)
						{
							if(html)
							{
								if(happyIGot=='true')
									{
										
										if(session && session=='1')
												{
													var mynew = pathname.replace('specification:'+label_checkbox_value+'','');
													var mynew_2 = mynew.replace(','+label_checkbox_value+'','');
													var mynew_3 = mynew_2.replace(','+label_checkbox_value+'','');
													pathname = mynew_3;
												}
											else
												{
													pathname = pathname+','+label_checkbox_value;
												}
									}
								else
									{
										pathname = pathname+'/specification:'+label_checkbox_value;
									}
								//return false;
								if(pathname && pathname!="")
									{
										window.location.href = pathname;
									}
							}
						   
						}
				});
				
				
			 });
		 });
		 
		 
   </script>
</head>
